package com.sunreal.paygateway.sys.util.result;

import java.util.ArrayList;
import java.util.List;

/**
 * Description: DataGrid
 * Author: liuzh
 * Update: liuzh(2014-04-22 11:59)
 */
public class DataGrid {
    public static final DataGrid EMPTY_DATAGRID = new DataGrid(new ArrayList(0));

    private long total;
    private List rows;

    public DataGrid() {
    }

    public DataGrid(Page page) {
        this.total = page.getTotal();
        this.rows = page;
    }

    public DataGrid(List list) {
        if (list instanceof Page) {
            Page page = (Page) list;
            this.total = page.getTotal();
            this.rows = page;
        } else {
            this.total = list.size();
            this.rows = list;
        }
    }

    public DataGrid(long total, List rows) {
        this.total = total;
        this.rows = rows;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List getRows() {
        return rows;
    }
}
